﻿''' <summary>
''' Helper class that keeps information about a GAC entry.
''' </summary>
''' <remarks></remarks>
Public Class GACEntry
    Implements IComparable(Of GACEntry)

    ''' <summary>
    ''' Assembly name.
    ''' </summary>
    ''' <remarks></remarks>
    Protected m_name As String

    ''' <summary>
    ''' Assembly version.
    ''' </summary>
    ''' <remarks></remarks>
    Protected m_version As String

    ''' <summary>
    ''' Assembly key.
    ''' </summary>
    ''' <remarks></remarks>
    Protected m_key As String

    ''' <summary>
    ''' Get/set the assembly name.
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Property Name() As String
        Get
            Return m_name
        End Get
        Set(ByVal value As String)
            m_name = value
        End Set
    End Property

    ''' <summary>
    ''' Get/set the assembly version.
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Property Version() As String
        Get
            Return m_version
        End Get
        Set(ByVal value As String)
            m_version = value
        End Set
    End Property

    ''' <summary>
    ''' Get/set the assembly key.
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Property Key() As String
        Get
            Return m_key
        End Get
        Set(ByVal value As String)
            m_key = value
        End Set
    End Property

    ''' <summary>
    ''' Default class constructor.
    ''' </summary>
    ''' <param name="name">Assembly name.</param>
    ''' <param name="version">Assembly version.</param>
    ''' <param name="key">Assembly key.</param>
    ''' <remarks></remarks>
    Public Sub New(ByVal name As String, ByVal version As String, ByVal key As String)
        Me.name = name
        Me.version = version
        Me.key = key
    End Sub

    ''' <summary>
    ''' Implemented to allow for custom sorting.
    ''' </summary>
    ''' <param name="other">Other instance of GACEntry to compare this instance to.</param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function CompareTo(ByVal other As GACEntry) As Integer Implements System.IComparable(Of GACEntry).CompareTo
        If Me.Name <> other.Name Then
            Return String.Compare(Me.Name, other.Name)
        Else
            Return String.Compare(Me.Version, other.Version)
        End If
    End Function
End Class